package com.first.server.controller.admin;

import com.first.common.result.PageResult;
import com.first.common.result.Result;
import com.first.pojo.dto.PlaceWorkUserDTO;
import com.first.pojo.dto.UserPageQueryDTO;
import com.first.pojo.dto.WorkPageQueryDTO;
import com.first.pojo.entity.PlaceWorkUser;
import com.first.pojo.entity.Work;
import com.first.pojo.vo.WorkVO;
import com.first.server.service.PlaceService;
import com.first.server.service.UserService;
import com.first.server.service.WorkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "成果管理接口")
@RequestMapping("admin/work")
public class WorkController {
    @Autowired
    private UserService userService;
    @Autowired
    private PlaceService placeService;
    @Autowired
    private WorkService workService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    public Result<PageResult> page(WorkPageQueryDTO workPageQueryDTO) {
        log.info("分页查询：{}",workPageQueryDTO);
        PageResult pageResult = workService.pageQuery(workPageQueryDTO);
        return Result.success(pageResult);
    }

    @PutMapping("/add")
    @ApiOperation("添加成果")
    public Result addWork(@RequestBody WorkVO workVO){
        log.info("成果信息：{}",workVO);
        workService.addWork(workVO);
        return Result.success();
    }

}
